package ArrayListTest;

import java.util.ArrayList;
//添加学生变量，遍历学生
public class Test1 {
    public static void main(String[] args) {
        ArrayList<student> list = new ArrayList<>();

        student s1 = new student("周星驰",56);
        student s2 = new student("刘亦菲",35);
        student s3 = new student("孙燕姿",46);

        list.add(s1);
        list.add(s2);
        list.add(s3);

        for(int i = 0 ; i <list.size(); i++){
            student str = list.get(i);
            System.out.println(str.getName()+", "+str.getAge());
        }
    }
}
